package com.qingcloud.fexecutor.base.enums;

/**
 * 组件运行方式枚举
 *
 * @author wangjinnan
 */
public enum ComponentRunModeEnum {

    /**
     * 独立式
     */
    ALONE(1, "独立式"),

    /**
     * 嵌入式
     */
    EMBED(2, "嵌入式");

    /**
     * 类型编码
     */
    public final Integer code;

    /**
     * 描述
     */
    public final String desc;

    ComponentRunModeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static ComponentRunModeEnum findByCode(int code) {
        for (ComponentRunModeEnum item : ComponentRunModeEnum.values()) {
            if (item.code == code) {
                return item;
            }
        }
        return ALONE;
    }

}
